/*
 * @Description: js-sdk for cess storage
 * @Autor: cess lab
 */

import { ApiPromise, WsProvider, Keyring } from "@polkadot/api";
import defaultConfig from "./default-config";

export default async function init(config = defaultConfig){
  const wsProvider = new WsProvider(config.nodeURL);
  const api = await ApiPromise.create({ provider: wsProvider });
  const keyring = new Keyring(config.keyringOption);
  return { api, keyring };
};
